<?php

namespace app\traits;

trait Page
{
    public static function wrap($totalCount, $page, $length, $data, $extraData = [])
    {
        $totalPage = ceil($totalCount / $length);

        return array_merge([
            'count' => $totalCount,
            'total_page' => $totalPage,
            'current_page' => $page,
            'length' => $length,
            'data' => $data
        ], $extraData);
    }
}